package main

import "fmt"

func main()  {
	//变量交换传统写法，使用临时变量暂存
	var a int = 10
	var b int = 20
	fmt.Printf("ab初始值：a = %d, b = %d\n", a, b)
	var tmp int
	tmp = a
	a = b
	b = tmp
	fmt.Printf("传统写法：a = %d, b = %d\n", a, b)

	//go全新写法
	c, d := 10, 20
	fmt.Printf("cd初始值：c = %d, d = %d\n", c, d)
	c, d = d, c
	fmt.Printf("go全新写法：c = %d, d = %d\n", c, d)
}
